//
//  borkenLineViewController.m
//  myselfTest
//
//  Created by Lucifer on 15-5-27.
//  Copyright (c) 2015年 xuxzhou. All rights reserved.
//

#import "borkenLineViewController.h"
#import "PNLineChartView.h"
#import "PNPlot.h"
@interface borkenLineViewController ()
@property (strong, nonatomic) IBOutlet PNLineChartView *lineChartView;

@end

@implementation borkenLineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    // test line chart
    _lineChartView=[[PNLineChartView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)*0.4)];
    NSArray* plottingDataValues1 =@[@61.3, @61, @62.5, @62,@60, @59,@58.9, @58, @57.5,@56, @55];
    NSArray* plottingDataValues2 =@[@62.4, @53.8, @58, @56,@53, @52,@53, @63, @54,@58, @63];
    _lineChartView.backgroundColor=[UIColor whiteColor];
    self.lineChartView.max = 65;
    self.lineChartView.min = 50;
    self.lineChartView.interval = (self.lineChartView.max-self.lineChartView.min)/5;
    NSMutableArray* yAxisValues = [@[] mutableCopy];
    for (int i=0; i<6; i++) {
        NSString* str = [NSString stringWithFormat:@"%.2f", self.lineChartView.min+self.lineChartView.interval*i];
        [yAxisValues addObject:str];
    }
    
    self.lineChartView.xAxisValues = @[@"1", @"2", @"3",@"4", @"5", @"6",@"7", @"8", @"9",@"10", @"11"];
    self.lineChartView.yAxisValues = yAxisValues;
    self.lineChartView.axisLeftLineWidth = 39;
    
    
    PNPlot *plot1 = [[PNPlot alloc] init];
    plot1.plottingValues = plottingDataValues1;
    
    plot1.lineColor = [UIColor blueColor];
    plot1.lineWidth = 0.5;
    
    [self.lineChartView addPlot:plot1];
    
    
    PNPlot *plot2 = [[PNPlot alloc] init];
    
    plot2.plottingValues = plottingDataValues2;
    
    plot2.lineColor = [UIColor redColor];
    plot2.lineWidth = 1;
    
    [self.lineChartView  addPlot:plot2];
    [self .view addSubview:_lineChartView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
